package Homework6;

import javax.print.attribute.standard.RequestingUserName;
import java.util.Arrays;

abstract class AnimalAPP{
    public  String  name;
    public AnimalAPP(String name){
        this.name=name;
    }
    abstract public void makeSound();
}

class  Tiger extends  AnimalAPP{
    public Tiger(String name){
        super(name);
    }
    public  void makeSound(){
        System.out.println("Tiger"+name+" makes a sound:waou");
    }
}
class  Elephant  extends  AnimalAPP{
    public  Elephant(String name){
        super(name);
    }
    public  void makeSound(){
        System.out.println("Elephant"+name+ "makes a sound:momo");
    }
}
class  Fox extends  AnimalAPP{
    public Fox(String name){
        super(name);
    }
    public  void makeSound(){
        System.out.println("Fox"+ name+"makes a sound:yip");
    }
}
class  Panda extends  AnimalAPP{
    public Panda(String name){
        super(name);
    }
    public  void makeSound(){
        System.out.println("Panda"+name+ "makes a sound:Chirp");
    }
}
public class Animal {
    public  static void main(String[] args){
        AnimalAPP []a=new AnimalAPP[4];
        a[0]=new Tiger("大王");
        a[1]=new Elephant("香香");
        a[2]=new Fox("呼呼");
        a[3]=new Panda("花花");
        for(AnimalAPP animal:a){
            animal.makeSound();}


    }
}
